import setupUserLoginInfoGuard from './userLoginInfo';
import setupPermissionGuard from './permission';
import NProgress from 'nprogress';
import { Router } from 'vue-router';

function setupPageGuard(router: Router) {
  router.beforeEach((to, from, next) => {
    next();
  });
  router.afterEach(() => {
    NProgress.done();
  });
}

export default function createRouteGuard(router: Router) {
  setupPageGuard(router);
  setupUserLoginInfoGuard(router);
  setupPermissionGuard(router);
}
